package com.eam.common.utils.common;

/**
 * @description:
 * @author: lx
 * @create: 2023-08-23 17:16
 **/

public class FigureUtils {

    /**
     * 补齐前面的0
     * @param number
     * @param width
     * @return
     */
    public static String padWithZeros(int number, int width) {
        String numberStr = String.valueOf(number);
        int zerosToAdd = Math.max(0, width - numberStr.length());
        StringBuilder result = new StringBuilder();

        for (int i = 0; i < zerosToAdd; i++) {
            result.append("0");
        }

        result.append(numberStr);
        return result.toString();
    }

}
